import { apiImgUrl } from "../utils/env";

/**
 * 格式化图片src地址
 */
export const useImgSrc = (src, domain = apiImgUrl) => {
  if (!src) return src;
	const imgs = src.split(",") ?? []
	if(!imgs[0]) return src;
	const imgSrc = imgs[0]
  const hasHttp = imgSrc.includes("http");
  if (hasHttp) return imgSrc;
  else return domain + imgSrc;
};
